package com.larosa.practice.strategy;

import com.larosa.practice.fruitenum.Fruit;

import java.math.BigDecimal;

/**
 * @Author: larosa
 * @Description: 草莓 8 折策略
 * @DateTime: 2025/2/9 9:30
 **/
public class StrawberryDiscountStrategy implements PricingStrategy {
    private static final BigDecimal STRAWBERRY_DISCOUNT = new BigDecimal("0.8");
    @Override
    public BigDecimal calculateTotalPrice(int appleQuantity, int strawberryQuantity, int mangoQuantity) {
        BigDecimal appleTotal = Fruit.APPLE.getPrice().multiply(BigDecimal.valueOf(appleQuantity));
        BigDecimal strawberryTotal = Fruit.STRAWBERRY.getPrice().multiply(BigDecimal.valueOf(strawberryQuantity)).multiply(STRAWBERRY_DISCOUNT);
        BigDecimal mangoTotal = Fruit.MANGO.getPrice().multiply(BigDecimal.valueOf(mangoQuantity));
        return appleTotal.add(strawberryTotal).add(mangoTotal);
    }
}
